<template>
	<view>
		<view class="selectClass">
			<view>棱块是否保持色向借位</view>
			<switch :checked="edgeIsKeep" @change="changeE_j();"></switch>
		</view>
		
		<prettyChange :list="edgeLendList" :S="edgeS" @change="sortChange"></prettyChange>
	</view>
</template>

<script>
	import constant from '../../utils/constant';
	import prettyChange from '../../components/pretty-exchange/pretty-exchange.vue'
	import storage from "../../utils/storage";
	export default {
		components: {
		            prettyChange
		        },
		data() {
			return {
				edgeLendList: [],
				itemHeight: 90,
				edgeIsKeep:true,
				edgeS:[]
				
			};
		},
		onLoad() {
			var edgeLend = constant.getEdgeLend();
			this.edgeIsKeep = constant.getEdgeIsKeep();
			this.edgeLendList = Array.from(constant.getEdgeLendShow(edgeLend));
			this.edgeS = constant.getEdgeS();
		},
		methods:{
			sortChange(edgeLendList){
			    var res = [];
			    for(var i = 0;i<edgeLendList.length;i++){
			    	res.push(edgeLendList[i].value);
			    }
			    storage.setStorageSync('edgeLend',res);
			    uni.$emit('update');
			},
			changeE_j(){
				this.edgeIsKeep = !this.edgeIsKeep;
				storage.setStorageSync('edgeIsKeep',this.edgeIsKeep);
				console.log('e_iskeep:'+this.edgeIsKeep);
				uni.$emit('update');
			}
						
		}
	}
</script>

<style lang="scss">
	.selectClass {
		margin: 10rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
	}
//scoped 在当前页生效 不影响子组件
	.drag-item{
		flex-direction: column;
		display: flex;
		align-items: center;
	}
</style>

